/* ChatHistory组件样式 */
.chat-history {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #1a1a2e;
  transition: background-color 0.3s ease;
}

/* 侧边栏头部样式 */
.sidebar-header {
  padding: 15px;
  border-bottom: 1px solid #334155;
  background: #1a1a2e;
  position: relative;
  flex-direction: column;
}

.sidebar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.sidebar-title img {
  width: 24px;
  height: 24px;
  background-color: transparent;
  border-radius: 4px;
}

.new-chat-btn {
  flex: 1;
  width: 100%;
  padding: 8px;
  margin: 10px 0 0 0 ;
  background: linear-gradient(135deg, #7877c6 0%, #5a5a9a 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.new-chat-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(120, 119, 198, 0.3);
}

.collapse-btn {
  border: none;
  width: 28px;
  height: 28px;
  padding: 0;
  background: #1a1a2e;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #e2e8f0;
}

.collapse-btn:hover {
  transform: scale(1.05);
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.history-item {
  display: flex;
  align-items: center;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease-in-out;
  background: var(--history-item-bg, white);
  border: 1px solid var(--history-item-border, #e5e7eb);
  transform: translateX(0);
  opacity: 1;
}

/* 新对话项滑入动画 */
.history-item.slide-in {
  animation: slideInFromRight 0.5s ease-out forwards;
}

@keyframes slideInFromRight {
  0% {
    transform: translateX(100%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

.history-item:hover {
  background: var(--history-item-hover-bg, #f3f4f6);
  border-color: var(--history-item-hover-border, #d1d5db);
}

.history-item.active {
  background: var(--history-item-active-bg, #e0f2fe);
  border-color: var(--history-item-active-border, #0ea5e9);
}

.chat-icon {
  font-size: 18px;
  margin-right: 12px;
  flex-shrink: 0;
}

.chat-info {
  flex: 1;
  min-width: 0;
}

.chat-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary, #374151);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-preview {
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-time {
  font-size: 11px;
  color: var(--text-tertiary, #9ca3af);
}

.delete-btn {
  opacity: 0;
  padding: 4px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 4px;
  transition: opacity 0.2s;
  font-size: 14px;
}

.history-item:hover .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  background: var(--delete-btn-hover-bg, #fee2e2);
  color: var(--delete-btn-hover-color, #dc2626);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--empty-state-color, #6b7280);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-hint {
  font-size: 12px;
  margin-top: 8px;
  opacity: 0.7;
}

/* 滚动条样式 */
.history-list::-webkit-scrollbar {
  width: 4px;
}

.history-list::-webkit-scrollbar-track {
  background: var(--scrollbar-track, #f1f1f1);
}

.history-list::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb, #c1c1c1);
  border-radius: 2px;
}

.history-list::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover, #a8a8a8);
}